
***********
***Figure 1 Entries
***********
sort ELECID
by ELECID: sum statisfaction_change
ttest statisfaction_change=0 if ELECID==1 // Lucerne national
ttest statisfaction_change=0 if ELECID==2 // Lucerne regional
ttest statisfaction_change=0 if ELECID==3 // Zurich national
ttest statisfaction_change=0 if ELECID==4 // Zurich regional
ttest statisfaction_change=0 if ELECID==5 // IDF national 
ttest statisfaction_change=0 if ELECID==6 // Provence national
ttest statisfaction_change=0 if ELECID==7 // Catalonia national
ttest statisfaction_change=0 if ELECID==8 // Catalonia regional
ttest statisfaction_change=0 if ELECID==9 // Madrid national
ttest statisfaction_change=0 if ELECID==10 // Lower Saxony national
ttest statisfaction_change=0 if ELECID==11 // Lower Saxony regional
ttest statisfaction_change=0 if ELECID==14 // Ontario regional
ttest statisfaction_change=0 if ELECID==15 // Quebec regional
ttest statisfaction_change=0  // All pooled


***********
***Table 1
***********	
 // model 1
reg statisfaction_change votes_outcome100 satisfaction_before female age educ b2.ELECID 	
 // model 2
reg statisfaction_change seats_outcome100 satisfaction_before female age educ b2.ELECID 	
 // model 3
reg statisfaction_change votes_outcome100 seats_outcome100 	 satisfaction_before female age educ b2.ELECID 	
 // model 4
reg statisfaction_change votes_outcome100 seats_outcome100 	cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 


***********
***Table 2 and Figure 2
***********
reg statisfaction_change i.power satisfaction_before female age educ b2.ELECID 
margins, at(power=(0(1)3))  atmeans
marginsplot, ///	 
			recast(bar)  ytitle("") xtitle("Predicted Change in Satisfaction with Democracy") title("") /// 
			horizontal scheme(s1color) aspect(.30, placement(south)) scale(.80)  ///
			plot1opts(bcolor(green) barw(.75)) ci1opts(color(green*.35))  
			
			
			
***********
***Table 3
***********		
 // model 6
reg statisfaction_change c.representation_deficit 		 satisfaction_before female age educ b2.ELECID 
// model 7
reg statisfaction_change c.representation_deficit 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID  
//model 8
reg statisfaction_change c.representation_deficit##c.campaign_activity 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
//model 9
reg statisfaction_change c.representation_deficit##c.considered_other_party 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
//model 10
reg statisfaction_change c.representation_deficit##c.outcome_reflects 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
//model 11
reg statisfaction_change c.representation_deficit##c.seats_outcome100 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 		



***********
***Figure 3
***********	
reg statisfaction_change c.representation_deficit 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
margins ,  at(representation_deficit=(-20(2.5)15)) atmeans 
marginsplot, ///
     recast(line) recastci(rarea) scheme(s1color) xdimension(representation_deficit) ///
     ci1opts(fcolor(purple*.35) lcolor(purple*.35) lwidth(thin))  /// 
     plot1opts(lcolor(purple) lwidth(medthick))  ///  
	 xlabel(-20(5)15) /// 
     xtitle(Representation Deficit) title("") ytitle(Predicted Change in Satisfaction with Democracy) 




***********
***Figure 4
***********	
*NW Panel
reg statisfaction_change c.representation_deficit##c.campaign_activity 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
margins ,  at(representation_deficit=(-20(2.5)15) campaign_activity=(0(3)3)) atmeans 
marginsplot, ///
     recast(line) recastci(rarea) scheme(s1color) xdimension(representation_deficit) ///
	 ci1opts(fcolor(blue*.35) lcolor(blue*.35) lwidth(thin))  /// 
     plot1opts(lcolor(blue) lwidth(medthick))  /// 
	 ci2opts(fcolor(red*.35) lcolor(red*.35) lwidth(thin))  /// 
     plot2opts(lcolor(red) lwidth(medthick))  ///  
	 xlabel(-20(5)15) /// 
	 legend(order(3 "No Campaign Activity" 4 "High Campaign Activity") rows(2)) ///
	 xtitle(Representation Deficit) title("") ytitle(Predicted Change in Satisfaction with Democracy) 


*NE Panel
reg statisfaction_change c.representation_deficit##c.considered_other_party 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
margins ,  at(representation_deficit=(-20(2.5)15) considered_other_party=(0(1)1)) atmeans 
marginsplot, ///
     recast(line) recastci(rarea) scheme(s1color) xdimension(representation_deficit) ///
     ci1opts(fcolor(red*.35) lcolor(red*.35) lwidth(thin))  /// 
     plot1opts(lcolor(red) lwidth(medthick))  ///  
	 ci2opts(fcolor(blue*.35) lcolor(blue*.35) lwidth(thin))  /// 
     plot2opts(lcolor(blue) lwidth(medthick))  ///   
	 xlabel(-20(5)15) /// 
	 legend(order(3 "Did Not Consider Voting for Another Party" 4 "Considered Voting for Another Party") rows(2))  ///
     xtitle(Representation Deficit) title("") ytitle(Predicted Change in Satisfaction with Democracy) 

*SE Panel
reg statisfaction_change c.representation_deficit##c.seats_outcome100 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
margins ,  at(representation_deficit=(-20(2.5)15) seats_outcome100=(5(45)50)) atmeans 
marginsplot, ///
     recast(line) recastci(rarea) scheme(s1color) xdimension(representation_deficit) ///
     ci1opts(fcolor(red*.35) lcolor(red*.35) lwidth(thin))  /// 
     plot1opts(lcolor(red) lwidth(medthick))  ///  
	 ci2opts(fcolor(blue*.35) lcolor(blue*.35) lwidth(thin))  /// 
     plot2opts(lcolor(blue) lwidth(medthick))  ///   
	 xlabel(-20(5)15) /// 
	 legend(order(3 "Five Percent of Seats" 4 "Fifty Percent of Seats") rows(2))  ///
     xtitle(Representation Deficit) title("") ytitle(Predicted Change in Satisfaction with Democracy) 

*SW Panel
reg statisfaction_change c.representation_deficit##c.outcome_reflects 		cab_seats_outcome100 satisfaction_before female age educ b2.ELECID 
margins ,  at(representation_deficit=(-20(2.5)15) outcome_reflects=(0(10)10)) atmeans 
marginsplot, ///
     recast(line) recastci(rarea) scheme(s1color) xdimension(representation_deficit) ///
     ci1opts(fcolor(red*.35) lcolor(red*.35) lwidth(thin))  /// 
     plot1opts(lcolor(red) lwidth(medthick))  ///  
	 ci2opts(fcolor(blue*.35) lcolor(blue*.35) lwidth(thin))  /// 
     plot2opts(lcolor(blue) lwidth(medthick))  ///   
	 xlabel(-20(5)15) /// 
	 legend(order(3 "Outcome Does Not Reflect Views" 4 "Outcome Reflects Views") rows(2))  ///
     xtitle(Representation Deficit) title("") ytitle(Predicted Change in Satisfaction with Democracy) 











